package com.jhonatan.sitcom.util;

import android.app.Activity;
import android.content.Context;
import android.view.Menu;
import android.view.MenuItem;

import com.jhonatan.sitcom.R;

public class Global {
	 String  baseUrl;
	 Context context;
	public Global() {
		baseUrl="http://192.168.1.8/mtps/"; // localhost
		//baseUrl="http://10.0.2.2/mtps/"; // emulador
		//baseUrl="http://192.168.1.200/sitcom/"; // mtps
	}

	public String getBaseUrl() {
		return baseUrl;
	}
	
    public boolean onCreateOptionsMenu(Menu menu, Activity la) 
    {
       la.getMenuInflater().inflate(
        		R.menu.menus_contextual, menu);
        return true;
    }
    
    public boolean onOptionsItemSelected(MenuItem item, Context context) 
    {	this.context=context;
    	System.out.println("click");
        switch (item.getItemId()) 
        {
            case R.id.mn_cerrar_session:
                cerrar_sesion();
                return true;
                        
            default:
                return false;
        }
    }

	private void cerrar_sesion() {
		// TODO Auto-generated method stub
	System.out.println("Cerrar sesion action");
	DataBaseManager manager = new DataBaseManager(context);
	manager.modificar("userStatus", "0");
	try {
		Thread.sleep(1000);
	} catch (InterruptedException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	System.exit(0);
	}

	
	 

}
